﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UCNgachBacLuong.ascx.cs"
    Inherits="Viewer.NhanSu.UserControl.UCNgachBacLuong" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<%@ Register Src="~/NhanSu/UserControl/UCTimNgach.ascx" TagName="UCTimNgach" TagPrefix="uc" %>
<link href="../../resources/css/main.css" rel="stylesheet" type="text/css" />
<style type="text/css">
    body
    {
        color: #57585B; /*dark gray*/
        font-size: 8px;
        font-family: Arial;
    }
</style>
<ext:XScript ID="XScipt1" runat="server">
    <script type="text/javascript">
        function FindEntityNgachCongChuc(str)
        {
            if(#{txtCodeNgach}.getValue().trim() != ''){
            #{DirectMethods}.FindCommonName_NgachCongChuc(str)
            }
            else{#{txtTenNgach}.setValue('');}
           
        }
        function InsertNgach(id,key,value) 
        { 
            if(#{hdStatus}.getValue()=='TimNgach')
            {          
                #{txtTenNgach}.setValue(value);   
                #{hdNgachCongChucId}.setValue(id);
                #{txtCodeNgach}.setValue(key);
            }     
            Ext.net.Mask.hide();
        }
        
    </script>
</ext:XScript>
<ext:Window ID="wdNgachBacLuong" runat="server" AutoHeight="true" Closable="false"
    Modal="true" Icon="TableCell" Width="400" Layout="Fit" AutoScroll="true" Hidden="true"
    Resizable="true" BodyCssClass="window">
    <Listeners>
    </Listeners>
    <Content>
        <ext:Panel ID="Panel1" runat="server" Frame="false" Border="false" AutoHeight="true"
            Icon="Information" BodyStyle="background-color: white;">
            <Content>
                <table width="100%">
                    <tr style="display: none;">
                        <td>
                            <ext:Hidden ID="hdParentType" runat="server" />
                            <ext:Hidden ID="hdType" runat="server" />
                            <ext:Hidden ID="hdNhanVienId" runat="server" />
                            <ext:Hidden ID="hdNgachId" runat="server" />
                            <ext:Hidden ID="hdNgachCongChucId" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Mã ngạch
                        </td>
                        <td>
                            <ext:TextField ID="txtCodeNgach" runat="server" Width="200" EmptyText="Mã ngạch">
                                <Listeners>
                                    <Change Handler="FindEntityNgachCongChuc(#{txtCodeNgach}.getValue());" Delay="250" />
                                </Listeners>
                            </ext:TextField>
                        </td>
                        <td>
                            <ext:Button ID="btn1" runat="server" Text="Tìm ngạch" Icon="Find">
                                <Listeners>
                                    <Click Handler="Ext.net.Mask.show();MarkLookUp('TimNgach');#{DirectMethods}.LookUp_TimNgach();" />
                                </Listeners>
                            </ext:Button>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Ngạch công chức
                        </td>
                        <td>
                            <ext:TextField ID="txtTenNgach" runat="server" Width="200px" EmptyText="Tên ngạch"
                                ReadOnly="true">
                                <ToolTips>
                                    <ext:ToolTip ID="ToolTip1" runat="server" AutoHide="true" TrackMouse="true">
                                        <Listeners>
                                            <Show Handler="ShowTip(this,#{txtTenNgach}.getValue())" />
                                        </Listeners>
                                    </ext:ToolTip>
                                </ToolTips>
                            </ext:TextField>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Bậc lương
                        </td>
                        <td>
                            <ext:ComboBox ID="cbbBacLuong" runat="server" DisplayField="CodeValue" Width="150"
                                ValueField="CodeID">
                                <Store>
                                    <ext:Store ID="storeBacLuong" runat="server">
                                        <Reader>
                                            <ext:JsonReader IDProperty="CodeID">
                                                <Fields>
                                                    <ext:RecordField Name="CodeID" />
                                                    <ext:RecordField Name="CodeValue" />
                                                </Fields>
                                            </ext:JsonReader>
                                        </Reader>
                                    </ext:Store>
                                </Store>
                                <Triggers>
                                    <ext:FieldTrigger Icon="Clear" HideTrigger="true" />
                                </Triggers>
                                <Listeners>
                                    <Select Handler="this.triggers[0].show();" />
                                    <BeforeQuery Handler="this.triggers[0][ this.getRawValue().toString().length == 0 ? 'hide' : 'show']();" />
                                    <TriggerClick Handler="if (index == 0) { this.clearValue(); this.triggers[0].hide(); }" />
                                </Listeners>
                            </ext:ComboBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Hệ số
                        </td>
                        <td>
                            <ext:TextField ID="txtHeSo" runat="server" Width="150">
                            </ext:TextField>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Ngày hiệu lực
                        </td>
                        <td>
                            <ext:DateField Format="dd/MM/yyyy" ID="dtNgayHieuLuc" Vtype="daterange" runat="server"
                                AnchorHorizontal="100%" Width="100" SelectedDate="">
                                <CustomConfig>
                                    <ext:ConfigItem Name="endDateField" Value="#{dtNgayHetHieuLuc}" Mode="Value" />
                                </CustomConfig>
                            </ext:DateField>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top">
                            Lý do
                        </td>
                        <td>
                            <ext:TextArea ID="txtLyDo" runat="server" Width="200" />
                        </td>
                    </tr>
                    <tr>
                        <td valign="top">
                            Ghi chú
                        </td>
                        <td>
                            <ext:TextArea ID="txtGhiChu" runat="server" Width="200" />
                        </td>
                    </tr>
                </table>
            </Content>
        </ext:Panel>
    </Content>
    <Buttons>
        <ext:Button ID="btnSave" runat="server" Text="Lưu" Icon="Disk">
        <Listeners><Click Handler="Ext.net.Mask.show();" /></Listeners>
            <DirectEvents>
                <Click OnEvent="btnSaveNBL_CLick">
                </Click>
            </DirectEvents>
        </ext:Button>
        <ext:Button ID="Button1" runat="server" Text="Đóng" Icon="Cancel">
            <Listeners>
                <Click Handler="#{wdNgachBacLuong}.hide();" />
            </Listeners>
        </ext:Button>
    </Buttons>
</ext:Window>
<uc:UCTimNgach ID="UCTimNgach" runat="server" />
